using Microsoft.Xna.Framework.Graphics;
using System;
using System.Collections.Generic;
using UCS.XNA.Draughts.Boards;
using UCS.XNA.Utils;

namespace UCS.XNA.Draughts.Pieces
{
    public class QueenPiece : Piece
    {
        #region Constructors

        public QueenPiece(PieceColor color, BoardPosition boardPosition)
            : base(color, boardPosition)
        {
            this.InitializeValidMovementsList();
        }

        protected QueenPiece(QueenPiece piece)
            : base(piece)
        {
            this.InitializeValidMovementsList();
        }

        #endregion

        #region Private Methods

        private void InitializeValidMovementsList()
        {
            this._movements = new List<PieceMovement>();

            this._movements.Add(new PieceMovement(new BoardPosition(1, 1)));
            this._movements.Add(new PieceMovement(new BoardPosition(1, -1)));
            this._movements.Add(new PieceMovement(new BoardPosition(2, 2), new BoardPosition(1, 1)));
            this._movements.Add(new PieceMovement(new BoardPosition(2, -2), new BoardPosition(1, -1)));
            this._movements.Add(new PieceMovement(new BoardPosition(-1, 1)));
            this._movements.Add(new PieceMovement(new BoardPosition(-1, -1)));
            this._movements.Add(new PieceMovement(new BoardPosition(-2, 2), new BoardPosition(-1, 1)));
            this._movements.Add(new PieceMovement(new BoardPosition(-2, -2), new BoardPosition(-1, -1)));
        }

        #endregion

        #region Overriden Methods

        public override void InitializeTextures()
        {
            if (_color == PieceColor.Black)
                _texture = GameResources.Content.Load<Texture2D>("BlackQueen");
            else
                _texture = GameResources.Content.Load<Texture2D>("WhiteQueen");
        }

        public override Piece Clone()
        {
            return new QueenPiece(this);
        }

        #endregion
    }
}
